package com.tjvib.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.tjvib.R;
import com.tjvib.view.activity.LoginActivity;
import com.tjvib.view.activity.WebActivity;

public class PrivacyDialog extends Dialog {

    public PrivacyDialog(@NonNull Context context) {
        super(context);
    }

    public void showDialog(Context context, View.OnClickListener cancel) {
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_privacy, null);
        this.setContentView(view);
        this.setCanceledOnTouchOutside(false);
        this.show();

        this.findViewById(R.id.dialog_priva_tv_con).setOnClickListener(v -> {
            Intent intent = new Intent(context, WebActivity.class);
            intent.putExtra("URL", "http://122.152.206.37:8033/user-services-agreement.html");
            intent.putExtra("TITLE", "用户服务协议和隐私政策");
            context.startActivity(intent);
        });
        this.findViewById(R.id.dialog_priva_btn_confirm).setOnClickListener(v -> this.dismiss());
        this.findViewById(R.id.dialog_priva_btn_cancel).setOnClickListener(cancel);
    }
}
